<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>会议预约</title>
    <link rel="stylesheet" type="text/css" th:href="@{/css/reserve.css}" />
    <script type="text/javascript" th:src="@{/js/jquery-1.12.0.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/reserve.js}" ></script>
    <script type="text/javascript" th:src="@{/js/time.opt.js}"></script>
</head>
<body>
<div id="wrapper">
    <!-- <div class="header">
     <div class="ztl">
      <img src="resources/images/line.png" />
     </div>
     <div class="titlelist">
      <a href="javascript:;" class="fl"><img src="resources/images/back.png" onclick="GoBack()" /></a>
      <a href="javascript:;" class="fl flfont" onclick="GoBack()">返回</a>
      <a href="javascript:;" class="fl flfont" onClick=" closebi()" >关闭</a><span>新建会议</span>
      <a href="javascript:;" class="fr"><img src="resources/images/list.png" /></a>

     </div>
    </div>  -->
    <!--头部-->
    <div class="timelistbox clear">
        <ul class="timelist" id="timelist">
            <!--<li><span class="s_timelis today">12</span><span class="x_timelis">今天</span></li>
            <li><span class="s_timelis select day3">13</span><span class="x_timelis">周四</span></li>
            <li><span class="s_timelis day4">14</span><span class="x_timelis">周五</span></li>
            <li class="no"><span class="s_timelis day5">15</span><span class="x_timelis">周六</span></li>
            <li class="no"><span class="s_timelis day6">16</span> <span class="x_timelis">周日</span></li>
            <li><span class="s_timelis day7">17</span><span class="x_timelis">周一</span></li>
            <li><span class="s_timelis day8">18</span><span class="x_timelis">周二</span></li>  -->
        </ul>
    </div>
    <!--时间-->
    <div class="signalbox">
        <p>点击时间选择时间段：</p>
        <ol>
            <li><span class="color1"></span>可选</li>
            <li><span class="color2"></span>已选</li>
            <li><span class="color3"></span>不可选</li>
        </ol>
    </div>

    <div id="rooms">
        <!--示意图-->
        <div id="room_model" style="display:none">
            <div class="box">
                <div class="boxtitle">
                    <img th:src="@{/images/meeting.png}" alt="会议室" />
                    <span class="name">25楼IM会议室</span>
                    <a href="javascript:;" class="meetbtn meetbtn2">请选择</a>
                </div>
                <div class="ordertime">
                    <ul class="time1">
                        <li data-ind="0" data-val="830" class="isStart"><a href="javascript:;">08:30</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="1" data-val="900"><a href="javascript:;" >09:00</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="2" data-val="930"><a href="javascript:;" >09:30</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="3" data-val="1000"><a href="javascript:;">10:00</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="4" data-val="1030"><a href="javascript:;">10:30</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="5" data-val="1100"><a href="javascript:;">11:00</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="6" data-val="1130"><a href="javascript:;">11:30</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="7" data-val="1200" class="isEnd"><a href="javascript:;">12:00</a><div class="leftb"></div><div class="rightb"></div></li>
                    </ul>
                    <ul class="time2 clear">
                        <li data-ind="8" data-val="1400"><a href="javascript:;">14:00</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="9" data-val="1430"><a href="javascript:;">14:30</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="10" data-val="1500"><a href="javascript:;">15:00</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="11" data-val="1530"><a href="javascript:;">15:30</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="12" data-val="1600"><a href="javascript:;">16:00</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="13" data-val="1630"><a href="javascript:;">16:30</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="14" data-val="1700"><a href="javascript:;">17:00</a><div class="leftb"></div><div class="rightb"></div></li>
                        <li data-ind="15" data-val="1730" class="isEnd"><a href="javascript:;">17:30</a><div class="leftb"></div><div class="rightb"></div></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <input id="val_toDay" type="hidden" th:value="${toDay}"/>
    <div class="js_dialog" id="dialogMsg" style="display:none">
        <div class="weui-mask"></div>
        <div class="weui-dialog">
            <div class="weui-dialog__bd">预定成功</div>
            <div class="weui-dialog__ft">
                <a href="javascript:clickCancelMeeting();" class="weui-dialog__btn weui-dialog__btn_default diaolgBtn btn_cancelMeeting" style="color:#353535">撤销会议</a>
                <a href="javascript:closeMsg();" class="weui-dialog__btn weui-dialog__btn_primary btn_close">返回</a>
            </div>
        </div>
    </div>

    <div class="js_dialog" id="dialogConfim" style="display:none">
        <div class="weui-mask"></div>
        <div class="weui-dialog">
            <div class="weui-dialog__bd">确认吗</div>
            <div class="weui-dialog__ft">
                <a href="javascript:closeConfim();" class="weui-dialog__btn weui-dialog__btn_default btn_close" style="color:#353535">否</a>
                <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary btn_ok">是</a>
            </div>
        </div>
    </div>

    <div class="js_dialog" id="dialogUsers" style="display:none">
        <div class="weui-mask"></div>
        <div class="weui-dialog" style="height: 90%;">

            <div style="width:100%;height:100%;position:relative;">
                <div style="height:96px">
                    <div class="weui-dialog__hd hid_selUsers">
                        <strong class="weui-dialog__title">选择开会成员(<span id="selMeetingUserNum">0</span>)</strong>
                        <div class="weui-search-bar" id="searchBar" style="margin-top: 0.5em;">
                            <form class="weui-search-bar__form">
                                <div class="weui-search-bar__box">
                                    <i class="weui-icon-search"></i>
                                    <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" required="">
                                    <!-- <a href="javascript:" class="weui-icon-clear" id="searchClear"></a> -->
                                </div>
                                <label class="weui-search-bar__label" id="searchText">
                                    <i class="weui-icon-search"></i>
                                    <span>搜索</span>
                                </label>
                            </form>
                            <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
                        </div>
                    </div>
                    <div class="weui-dialog__hd hid_setTopic">
                        <strong class="weui-dialog__title">会议主题</strong>
                    </div>
                </div>

                <div style="position:absolute;top:96px;bottom:48px;width:100%">
                    <div id="departments-div" class="weui-dialog__bd hid_selUsers" style="height:100%;padding:0.3em 20px;overflow: auto;text-align:left;color: black;">
                        <div id="div_isHasComp" style="text-align:center;display:none">无匹配成员</div>
                    </div>
                    <!-- 填写会议主题 -->
                    <div id="departments-topic-div" class="weui-dialog__bd hid_setTopic" style="height:100%;padding:0.3em 20px;overflow: auto;text-align:left;color: black;">

                        <div class="weui-cell" style="padding:0 15px">
                            <div class="weui-cell__bd">
                                <textarea id="val_topic" class="weui-textarea" placeholder="请填写会议主题(尽量简洁)" rows="3" style="height:8em;border: 1px solid #e0e0e0;"></textarea>
                                <!-- <div class="weui-textarea-counter"><span>0</span>/200</div> -->
                            </div>
                        </div>
                        <div style="text-align:left;padding:15px">
                            <div style="text-align: right">通知人员(<span id="meetingUserNum">0</span>)</div>
                            <div id="showMeetingUsers">

                            </div>
                        </div>
                    </div>
                </div>

                <div style="position:absolute;height:48px;bottom:0;width:100%">
                    <div class="weui-dialog__ft">
                        <a href="javascript:;" id="btn_cancelSelUser" class="weui-dialog__btn weui-dialog__btn_default btn_close" style="color:#353535">取消</a>
                        <a href="javascript:;" id="btn_confimSelUser" class="weui-dialog__btn weui-dialog__btn_primary btn_ok">确认</a>
                    </div>
                </div>
            </div>



        </div>
    </div>

</div>
</body>
<script language="JavaScript" th:inline="JavaScript">
    var rooms =[[${rooms}]];	//[{"id":1,"name":"25楼IM会议室","enable":true},{"id":2,"name":"龙华4楼IM会议室","descriptionKey":"投影机","enable":true},{"id":3,"name":"龙华15楼IM会议室","descriptionKey":"投影机,21人","enable":true}]
    var reserve =[[${reserve}]];	//[{"id":20,"roomId":1,"wxno":"zhangzhiji","creatTime":"2018-08-29 00:00:00","meetingDate":"2018-08-30 00:00:00","startTime":900,"endTime":1030},{"id":21,"roomId":1,"wxno":"zhangzhiji","creatTime":"2018-08-29 00:00:00","meetingDate":"2018-08-30 00:00:00","startTime":1030,"endTime":1200},{"id":22,"roomId":1,"wxno":"zhangzhiji","creatTime":"2018-08-29 00:00:00","meetingDate":"2018-08-30 00:00:00","startTime":1300,"endTime":1400},{"id":23,"roomId":1,"wxno":"zhangzhiji","creatTime":"2018-08-29 00:00:00","meetingDate":"2018-08-30 00:00:00","startTime":1430,"endTime":1500}]
    var reserveMap={};//{day:{roomId:[]}}
    var departments=[[${departments}]];//[{"id":10,"parentId":1,"name":"省微信运营团队","order":2147482880,"users":[{"wxno":"shisonglin","departmentId":[10],"name":"史松林","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh6SJGF12Ova5PyuPRLAXCS42EfVKQeMzIoUxIKVhwRz1/100","namePy":"shisonglin","namePyFirst":"ssl"},{"wxno":"shenhuiling","departmentId":[10],"name":"沈惠玲","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5Lf7D5sbnRj9EvtCz6xcvbPuafHppR0gg9HY3aiacdc6/100","namePy":"shenhuiling","namePyFirst":"shl"},{"wxno":"linqiuping","departmentId":[10],"name":"林秋苹","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh6kWDqytDa36BKiahuB4WicPCxkjkkr0Yum5YicgxryLekU/100","namePy":"linqiuping","namePyFirst":"lqp"},{"wxno":"gaoxiaoyan","departmentId":[10],"name":"高小燕","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQDqZAjTPCOicKAYw9v9bIvFp/100","namePy":"gaoxiaoyan","namePyFirst":"gxy"},{"wxno":"yangjiayuan","departmentId":[10],"name":"杨家媛","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5Fnpwk2QxTIGjCmXyPV2dfRBjk/100","namePy":"yangjiayuan","namePyFirst":"yjy"},{"wxno":"huangli","departmentId":[10],"name":"黄鹂","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5FnpwIF0PPYsl4ZUjUHZOL5aic1/100","namePy":"huangli","namePyFirst":"hl"},{"wxno":"liulifeng","departmentId":[10],"name":"刘莉峰","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5Fnpw11ibPyLTePHONqGfXRcg76/100","namePy":"liulifeng","namePyFirst":"llf"},{"wxno":"sanglongjiang","departmentId":[10],"name":"桑龙江","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5Fnpwf9TrBeST9v5F847cmEyYU/100","namePy":"sanglongjiang","namePyFirst":"slj"},{"wxno":"zengfangju","departmentId":[10],"name":"曾芳菊","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh6tfMAFKtZ39oicPj6lxfKfAiaA9iblKWxZA05QkMehroNL/100","namePy":"cengfangju","namePyFirst":"cfj"},{"wxno":"liangxuelin","departmentId":[10],"name":"梁学林","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5FnpwKtUS798ngksdbicMXUAfpE/100","namePy":"liangxuelin","namePyFirst":"lxl"},{"wxno":"lixiaopei","departmentId":[10],"name":"李晓培","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh6kWDqytDa36BKiahuB4WicPCRMQD0P3fibKBQzSGnxbhXia/100","namePy":"lixiaopei","namePyFirst":"lxp"},{"wxno":"zuomeixia","departmentId":[10],"name":"左美霞","avatar":"http://p.qlogo.cn/bizmail/Z7UI691s2WQsUQ7rWvQibgbf9vficUEc5EBuUwdOWNgNkxP3xwhF9Y6w/100","namePy":"zuomeixia","namePyFirst":"zmx"},{"wxno":"shenyangbo","departmentId":[10],"name":"沈阳波","avatar":"http://p.qlogo.cn/bizmail/HHdPXDNbRXmhRgTibnqicMlkn6riaLSb9FVBtBk5glZsHxhdp64Zz9JJQ/100","namePy":"shenyangbo","namePyFirst":"syb"},{"wxno":"wangjingjing","departmentId":[10],"name":"王静静","avatar":"http://p.qlogo.cn/bizmail/a8eSCdLv7WyibiboNx2Yx4FYhCJXAGMBu7XpflwduIUrKNvLZC9QYaSw/100","namePy":"wangjingjing","namePyFirst":"wjj"},{"wxno":"dengcong","departmentId":[10],"name":"邓聪","avatar":"http://p.qlogo.cn/bizmail/4nLhAwDYZVPrSnzjDqRib2nj1zC9YkBPRNuyW4Nial8PbmqqL0wqHrUA/100","namePy":"dengcong","namePyFirst":"dc"},{"wxno":"changtingting","departmentId":[10],"name":"常婷婷","avatar":"http://p.qlogo.cn/bizmail/PlUeZR0ufMkrzAgXnou559VZcibkZ0HGcQ6A5zRz0ZJib7pTfnasfBYQ/100","namePy":"changtingting","namePyFirst":"ctt"},{"wxno":"HuangYaJuan","departmentId":[10],"name":"黄雅娟","avatar":"http://p.qlogo.cn/bizmail/icKEicjkcfBUo7B2RoYAA34I2hUR0iaR1n1wll7QNFulpaiam4ookmSNVA/100","namePy":"huangyajuan","namePyFirst":"hyj"}]},{"id":2,"parentId":1,"name":"IM客服运营组","order":2147483392,"users":[{"wxno":"yangluxi","departmentId":[2],"name":"杨露茜","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQDxezBXawwTzoeeVntGUl4Z/100","namePy":"yangluqian","namePyFirst":"ylq"},{"wxno":"yejingjing","departmentId":[2],"name":"叶晶晶","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh52libYjBlXOgsIyehgA0Per2cicbcoPnjRIFulibiaAnoMj/100","namePy":"yejingjing","namePyFirst":"yjj"},{"wxno":"huanglili","departmentId":[2],"name":"黄鹂鹂","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh4nF9ria8Uc3Ig3viczj0icGibA7icDlERaslGOPMsyKtIvRJ/100","namePy":"huanglili","namePyFirst":"hll"},{"wxno":"xianglei","departmentId":[2],"name":"向雷","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5FnpwBhEQQg5BF3BVsoImOV7oe/100","namePy":"xianglei","namePyFirst":"xl"},{"wxno":"sunshutao","departmentId":[2],"name":"孙树涛","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5QadJrd7a3vSRl2nogiaC1EXH1VJGjNYwX20W5VJ3N0y/100","namePy":"sunshutao","namePyFirst":"sst"},{"wxno":"rockey","departmentId":[2,3],"name":"梁启炽","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh6tfMAFKtZ39oicPj6lxfKfAMRvSOLUlxmchXibIiaFjiaCP/100","namePy":"liangqichi","namePyFirst":"lqc"},{"wxno":"ZhuChaoFan","departmentId":[2],"name":"朱超凡","avatar":"http://p.qlogo.cn/bizmail/oRH2GyDGPwAODicg6IibNX8JyFwAcVAiang5bCEl8hia6H1yENZz8KjhuA/100","namePy":"zhuchaofan","namePyFirst":"zcf"},{"wxno":"xiexiaochun","departmentId":[2],"name":"谢晓纯","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh4nsgT6SwxicX19htQBnQkP7n3lvA9dxqKRINtnnatg0v/100","namePy":"xiexiaochun","namePyFirst":"xxc"},{"wxno":"WenLuCun","departmentId":[2],"name":"文露村","avatar":"http://p.qlogo.cn/bizmail/p0XTclaNSKkoGviaDlmXU1oUfW8nUH0Wl752lCVlrv3YUYSlooiawgkg/100","namePy":"wenlucun","namePyFirst":"wlc"}]},{"id":3,"parentId":1,"name":"IM话务台","order":2147483264,"users":[{"wxno":"rockey","departmentId":[2,3],"name":"梁启炽","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh6tfMAFKtZ39oicPj6lxfKfAMRvSOLUlxmchXibIiaFjiaCP/100","namePy":"liangqichi","namePyFirst":"lqc"},{"wxno":"zhangyuzhi","departmentId":[3],"name":"张玉知","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQDxRjpSeKfIV3XbOiawbibwff/100","namePy":"zhangyuzhi","namePyFirst":"zyz"},{"wxno":"zhouzhonghui","departmentId":[3],"name":"周宗慧","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5FnpwvxuOLLkJ01EiaIlbkmyqfx/100","namePy":"zhouzonghui","namePyFirst":"zzh"},{"wxno":"zhusuxian","departmentId":[3],"name":"朱苏娴","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5FnpwYGVEfBOAr0rLOudQu7P0G/100","namePy":"zhusuxian","namePyFirst":"zsx"},{"wxno":"linhang","departmentId":[3],"name":"林杭","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQDIPX2iaNZFf4jpmtX9uLBYt/100","namePy":"linhang","namePyFirst":"lh"},{"wxno":"yanping","departmentId":[3],"name":"闫萍","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQD6licKVXZAh5ibXnIJ1AOW5X/100","namePy":"yanping","namePyFirst":"yp"},{"wxno":"HuangShiQi","departmentId":[3],"name":"黄诗琪","avatar":"http://p.qlogo.cn/bizmail/ZgXD2whbzKr9ib4ZUDh5QPAsQb6TjCgqrMjBqqCB9PRHPFMtggMQJ7A/100","namePy":"huangshiqi","namePyFirst":"hsq"},{"wxno":"LiuMan","departmentId":[3],"name":"刘曼","avatar":"http://p.qlogo.cn/bizmail/QoNnxkhOSuCctTicBDvWI8JnjOvbfTxZTIQElmIeaLpt4cV5ISEYcEg/100","namePy":"liuman","namePyFirst":"lm"},{"wxno":"DengWeiJi","departmentId":[3],"name":"邓维吉","avatar":"http://p.qlogo.cn/bizmail/JBgicL4QHP2KmxJmA0OLibsYfSJ92w15ia4YZoxtfSRooR5tGZItYBtpA/100","namePy":"dengweiji","namePyFirst":"dwj"},{"wxno":"ZhongJinMei","departmentId":[3],"name":"钟金梅","avatar":"http://p.qlogo.cn/bizmail/Q21ZLSNgBwG89fz2riat69Bux3L9LHJcU4zibXYouiaMsib83DaOxIwEyg/100","namePy":"zhongjinmei","namePyFirst":"zjm"},{"wxno":"MiJie","departmentId":[3],"name":"米杰","avatar":"http://p.qlogo.cn/bizmail/k7gJxv30lrftNXNdNzpowPJn26GL0M49N8GOP4sKDh5JvHcg4p7aOQ/100","namePy":"mijie","namePyFirst":"mj"},{"wxno":"XieLiRong","departmentId":[3],"name":"谢丽容","avatar":"http://p.qlogo.cn/bizmail/fK4ia98gl6WgCxXLLmoLclKdsH3vcJrX0H0tShVMU4Xaxw6lQ8o9WwQ/100","namePy":"xielirong","namePyFirst":"xlr"},{"wxno":"ChenXiaoYu","departmentId":[3],"name":"陈小玉","avatar":"http://p.qlogo.cn/bizmail/luwwKOh08QA9xibFEf5UEE3hSagoCDJibWsfQND6jJLUAv6lHoiaNP7VQ/100","namePy":"chenxiaoyu","namePyFirst":"cxy"},{"wxno":"LinJiaTing","departmentId":[3],"name":"林佳婷","avatar":"http://p.qlogo.cn/bizmail/VBZLBBdwfxk29PXgswY2icT3axFZiaicwp0JkyictuXR52Jc6kp0PibjUkg/100","namePy":"linjiating","namePyFirst":"ljt"}]},{"id":11,"parentId":1,"name":"系统维护组","order":2147482624,"users":[{"wxno":"wanghui","departmentId":[11],"name":"王辉","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7jgAokktTSRKGbJ6gbanlib1lfxTfAY2jZeCaDs5OSMX/100","namePy":"wanghui","namePyFirst":"wh"},{"wxno":"weiwei","departmentId":[11],"name":"魏巍","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh6kWDqytDa36BKiahuB4WicPCWIiaen6HFfrr8t59xFL5Az/100","namePy":"weiwei","namePyFirst":"ww"},{"wxno":"zhangziming","departmentId":[11],"name":"张自明","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQD7d74A7IT8dWbsJzDmcfaf/100","namePy":"zhangziming","namePyFirst":"zzm"},{"wxno":"liyongjian","departmentId":[11],"name":"李永坚","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5QadJrd7a3vSRl2nogiaC1E2K0Ny30f6Hic8vLGlhmfoH/100","namePy":"liyongjian","namePyFirst":"lyj"},{"wxno":"lvning","departmentId":[11],"name":"吕泞","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5oVmczY5jUcBlQOQ5KrhBETP6sbp8flicRiawjULdnFoU/100","namePy":"lu:ning","namePyFirst":"ln"},{"wxno":"hejia","departmentId":[11],"name":"贺嘉","avatar":"/100","namePy":"hejia","namePyFirst":"hj"}]},{"id":27,"parentId":1,"name":"视频客服运营组","order":2147482496,"users":[{"wxno":"jiangpeiyuan","departmentId":[27],"name":"姜培元","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh4nF9ria8Uc3Ig3viczj0icGibAH1ks4jkg29qs4zDOE1Ltic/100","namePy":"jiangpeiyuan","namePyFirst":"jpy"},{"wxno":"jiangxuan","departmentId":[27],"name":"蒋瑄","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQDyTxibDf3DFKiaZo12XcRYGr/100","namePy":"jiangxuan","namePyFirst":"jx"},{"wxno":"wangzhenhua","departmentId":[27],"name":"王振华","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh530pDPqPf3aWx4Vd8LeCgjDh7j8qscKkPluCbOibBJaP/100","namePy":"wangzhenhua","namePyFirst":"wzh"},{"wxno":"tanwei","departmentId":[27],"name":"谭微","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7j4I7UWFOmnZnzhpv5FnpwThO6EMJHu34zcQmFEz7ID/100","namePy":"tanwei","namePyFirst":"tw"},{"wxno":"laikang","departmentId":[27],"name":"赖康","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5Lf7D5sbnRj9EvtCz6xcvbgdibNVajZMrISzAMqF8Dsf/100","namePy":"laikang","namePyFirst":"lk"},{"wxno":"xiaoyang","departmentId":[27],"name":"肖洋","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQDia44ssFTS8DdIvIb78ljAI/100","namePy":"xiaoyang","namePyFirst":"xy"},{"wxno":"lanyanbin","departmentId":[27],"name":"蓝彦彬","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQD1erDYSfaWPw3x9TLZtYvh/100","namePy":"lanyanbin","namePyFirst":"lyb"},{"wxno":"wangmingai","departmentId":[27],"name":"王明爱","avatar":"http://p.qlogo.cn/bizmail/ts3FjqFyhntWeBqmIjOC0DMcV1Y6KwicKgFAUKGP7LwrBI1OTyFkv7w/100","namePy":"wangmingai","namePyFirst":"wma"},{"wxno":"zhouluyao","departmentId":[27],"name":"周璐瑶","avatar":"http://p.qlogo.cn/bizmail/X2zvJmgdbcPEHRKyJ3sYAGvUicFZtmIK1Tgzmpgw1KfDj8cEvCU5iboQ/100","namePy":"zhouluyao","namePyFirst":"zly"},{"wxno":"chenping","departmentId":[27],"name":"陈萍","avatar":"http://p.qlogo.cn/bizmail/WIa7mAiaJwXxAiaD53NGubDCYsItmAJSvBv7dTmVecRLricBmE4icesndg/100","namePy":"chenping","namePyFirst":"cp"},{"wxno":"gaoyuetong","departmentId":[27],"name":"高跃铜","avatar":"","namePy":"gaoyuetong","namePyFirst":"gyt"},{"wxno":"gaojianwen","departmentId":[27],"name":"郜建文","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5xRZIfBBFlW6Fprt7F0GCyL0IczSqrDODM0liaqERZef/100","namePy":"gaojianwen","namePyFirst":"gjw"},{"wxno":"zhuoliangliang","departmentId":[27],"name":"卓亮亮","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQD7oNhIcGiaNyq4y5ABibp4WP/100","namePy":"zhuoliangliang","namePyFirst":"zll"},{"wxno":"chenxueqin","departmentId":[27],"name":"陈学琴","avatar":"http://p.qlogo.cn/bizmail/5sZE9T6dxZ3sha8icaakSO8RiaF7eM5VSNkibPictsMwTUwkoC3Tm0cApg/100","namePy":"chenxueqin","namePyFirst":"cxq"},{"wxno":"ZouQi","departmentId":[27],"name":"邹绮","avatar":"","namePy":"zouqi","namePyFirst":"zq"}]},{"id":9,"parentId":1,"name":"产品支撑组","order":2147483008,"users":[{"wxno":"honglingyu","departmentId":[9],"name":"洪凌毓","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7PNn7G8lclr29SRqC5ftmiaibwyIcCcrgRoJo0Iib1h4KZ/100","namePy":"honglingyu","namePyFirst":"hly"},{"wxno":"huangshunhua","departmentId":[9],"name":"黄顺华","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7jgAokktTSRKGbJ6gbanlib5wm2DRmWbtTyrhibDCrDT6/100","namePy":"huangshunhua","namePyFirst":"hsh"},{"wxno":"linqiaoling","departmentId":[9],"name":"林巧玲","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5cWgJfJibAfwOZ5Ibqdb4rdwoZtIicIX6byH4piaBXAy5ib/100","namePy":"linqiaoling","namePyFirst":"lql"},{"wxno":"yuxiao","departmentId":[9],"name":"余晓","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQD5pKNnb74RmECIHqKF3ZCn/100","namePy":"yuxiao","namePyFirst":"yx"},{"wxno":"hanlu","departmentId":[9],"name":"韩露","avatar":"http://p.qlogo.cn/bizmail/qx9k52SGudkl8hz4hUxOYXdDwyFAOQ3GGRKibHAvvUdEFLNQCX0gGtQ/100","namePy":"hanlu","namePyFirst":"hl"},{"wxno":"linjiewen","departmentId":[9],"name":"林洁纹","avatar":"http://p.qlogo.cn/bizmail/FU9bhPFH9z4Cia87prELes8HzxWHtkPG5mZgGKicIn8a9FxUYJBvCWQg/100","namePy":"linjiewen","namePyFirst":"ljw"},{"wxno":"lidingqiang","departmentId":[9],"name":"黎定强","avatar":"http://p.qlogo.cn/bizmail/OHR0UwyDczxBLHN1BL7SoxG6RwopIsHxc8s6slNRocpBKcibWwG1dR/100","namePy":"lidingqiang","namePyFirst":"ldq"},{"wxno":"LinRuiSheng","departmentId":[9],"name":"林锐升","avatar":"http://p.qlogo.cn/bizmail/PXJojTrzzyjIEMaM1rq1f9bsjTLcSSEeG9b7tqGjvicxphJNNBdXJOQ/100","namePy":"linruisheng","namePyFirst":"lrs"},{"wxno":"zhengxiaofeng","departmentId":[9],"name":"郑晓峰","avatar":"http://p.qlogo.cn/bizmail/S7QCk1ibicn5Ae7vVO9KdzATg6JwAs2K3hf0eNIiabbWZFh7TTngS6vFw/100","namePy":"zhengxiaofeng","namePyFirst":"zxf"},{"wxno":"huanghui","departmentId":[9],"name":"黄辉","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQDKZeJTVvD90uV5S4pYnLcZ/100","namePy":"huanghui","namePyFirst":"hh"},{"wxno":"ChenRu","departmentId":[9],"name":"陈如","avatar":"http://p.qlogo.cn/bizmail/oDjvIzLgL6A73eygdfbG1XZyv0ia37Z96uBEOdwJMpticzaj91cCBfKQ/100","namePy":"chenru","namePyFirst":"cr"}]},{"id":29,"parentId":1,"name":"应用开发组","order":2147481984,"users":[{"wxno":"huangrongwen","departmentId":[29],"name":"黄荣文","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5cWgJfJibAfwOZ5Ibqdb4rd4BfZDwYLDKficNMXA8FZvh/100","namePy":"huangrongwen","namePyFirst":"hrw"},{"wxno":"songerqiang","departmentId":[29],"name":"宋二强","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7BweJkTwIH5AIds7eh43FmicHItVMeAnV0vN2ehWLjAq/100","namePy":"songerqiang","namePyFirst":"seq"},{"wxno":"zhengpeng","departmentId":[29],"name":"郑鹏","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh52libYjBlXOgsIyehgA0PerpuibUysYAuG2haibsicgUVuz/100","namePy":"zhengpeng","namePyFirst":"zp"},{"wxno":"linyanhui","departmentId":[29],"name":"林燕辉","avatar":"http://p.qlogo.cn/bizmail/nOUF6bhibh9eHZOz35fw1JqnuubULtQA7R9AqmBl5XEbbgxOQppryLQ/100","namePy":"linyanhui","namePyFirst":"lyh"},{"wxno":"WeiShiLong","departmentId":[29],"name":"韦石龙","avatar":"http://p.qlogo.cn/bizmail/l2wB19ah3trMFWV6hmae0HUaKHrC9EGPfhtoWIgVCMkDydILlAw8lA/100","namePy":"weishilong","namePyFirst":"wsl"},{"wxno":"ZhangZhiJi","departmentId":[29],"name":"张智极","avatar":"http://p.qlogo.cn/bizmail/z21UohmudYBDN2OsMhZ2udqFXiaLezceRQVgusy1QvFEpmzranHdjdw/100","namePy":"zhangzhiji","namePyFirst":"zzj"}]},{"id":28,"parentId":1,"name":"数据服务组","order":2147482240,"users":[{"wxno":"dongjiang","departmentId":[28],"name":"董江","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5cWgJfJibAfwOZ5Ibqdb4rd9ibUgX5VXQnmJb2K769PrN/100","namePy":"dongjiang","namePyFirst":"dj"},{"wxno":"gaolanying","departmentId":[28],"name":"高兰英","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh5cWgJfJibAfwOZ5Ibqdb4rd2eDTvPZbVpNp5aRxAVJ7c/100","namePy":"gaolanying","namePyFirst":"gly"},{"wxno":"yangyuhuan","departmentId":[28],"name":"杨玉环","avatar":"http://shp.qpic.cn/bizmp/lZu2Kke8Wh7ibJU4F9iaw44rj5D588dSQDqyEonKibjRgLx2O0YBJb04/100","namePy":"yangyuhuan","namePyFirst":"yyh"}]}]
    var isSubmit=false;
    var isError = [[${isError}]];
    var GLOBAL_WXNO=[[${session.meeting_wxno}]];
    var currTime = new Date(parseInt($("#val_toDay").val()));
    var canCloseConfim=true;

    if(isError!=''){
        showMsg('用户验证失败,errcode:'+isError);
    }

    $(function(){
        loadReserve();
        loadRooms();
        refReserveUI();
        initDepartments();
        closeUsers();

        $("body").on('click','.meetbtn1',function(){

            var dialogUsers = $("#dialogUsers");
            var submBtn = $(this);
            var roomDiv = $(this).parent().parent();
            var roomId = roomDiv.attr('data-id');
            var roomName = roomDiv.find('span.name').text();
            var roomTimeDiv = roomDiv.find('.ordertime');
            var date = $("#timelist .select").attr('data-val');
            var startText = roomTimeDiv.find('.xuank a').text();
            var endText = roomTimeDiv.find('.xuanj a').text();
            var startTime = parseInt(roomTimeDiv.find('.xuank').attr('data-val'));
            var endTime = parseInt(roomTimeDiv.find('.xuanj').attr('data-val'));

            //submBtn.text('预定中···');
            if(!isNaN(endTime)){
                openUsers();
                confimSelUser(dialogUsers,submBtn,roomDiv,roomId,roomName,roomTimeDiv,date,startText,endText,startTime,endTime);
            }
        });

        var $searchBar = $('#searchBar'),
            $searchResult = $('#searchResult'),
            $searchText = $('#searchText'),
            $searchInput = $('#searchInput'),
            //$searchClear = $('#searchClear'),
            $searchCancel = $('#searchCancel');

        function hideSearchResult(){
            $searchResult.hide();
            $searchInput.val('');
        }
        function cancelSearch(){
            hideSearchResult();
            $searchBar.removeClass('weui-search-bar_focusing');
            $searchText.show();
        }

        $searchText.on('click', function(){
            $searchBar.addClass('weui-search-bar_focusing');
            $searchInput.focus();
        });
        $searchInput.on('blur', function () {
            if(!this.value.length) cancelSearch();
        })
            .on('input', function(){
                if(this.value.length) {
                    $searchResult.show();
                } else {
                    $searchResult.hide();
                }
            })
        ;
        /* $searchClear.on('click', function(){
            hideSearchResult();
            $searchInput.focus();
        }); */
        $searchCancel.on('click', function(){
            cancelSearch();
            $searchInput.blur();
            closeAllUser();
        });

        var time_searchInput;
        $searchInput.bind('input propertychange',function(){
            window.clearTimeout(time_searchInput);
            var obj = $(this);
            time_searchInput = window.setTimeout(function(){
                var searchName = $.trim(obj.val()).toLowerCase();
                $("#div_isHasComp").hide();

                if(searchName==''){
                    closeAllUser();
                }else{
                    var showList=[];

                    closeAllUser();
                    $.each($("#dialogUsers .list-user-div"),function(k,v){
                        var v = $(v);
                        if(v.attr('data-name').indexOf(searchName)!=-1 || v.attr('data-namepyfirst').startsWith(searchName) || v.attr('data-namepy').startsWith(searchName)){
                            v.show();
                            showList.push(v);
                        }else{
                            v.hide();
                        }
                    });

                    $("#dialogUsers .list-dep-parent").hide();
                    $.each(showList,function(k,v){
                        var p = v.parent();
                        if(p.css('display')=='none'){
                            clickListDepartment(p.prev());
                            p.parent().show();
                        }
                    });
                    if(showList.length==0){
                        $("#div_isHasComp").show();
                    }
                }

            },500);
        });


        $("#dialogUsers").on('click','.list-dep-div',function(){
            clickListDepartment($(this));
        });
        function clickListDepartment(div){
            if(div.find('i.point-right').size()>0){
                div.find('i.point-right').removeClass('point-right').addClass('point-down');
                div.next().show();
            }else{
                div.find('i.point-down').removeClass('point-down').addClass('point-right');
                div.next().hide();
            }
        }

        $("#dialogUsers").on('click','.list-user-parent>div',function(){
            var numObj = $("#selMeetingUserNum");
            var wxno = $(this).attr('data-wxno');
            if($(this).find('i.weui-icon-circle').size()>0){
                $(this).find('i.weui-icon-circle').removeClass('weui-icon-circle').addClass('weui-icon-success');
                if($("#dialogUsers .weui-icon-success[data-wxno="+wxno+"]").size()==1){
                    numObj.text(parseInt(numObj.text())+1);
                }
            }else{
                $(this).find('i.weui-icon-success').removeClass('weui-icon-success').addClass('weui-icon-circle');
                if($("#dialogUsers .weui-icon-success[data-wxno="+wxno+"]").size()==0){
                    numObj.text(parseInt(numObj.text())-1);
                }
            }
        });

    });

    function showMsg(text,showBtn){
        $("#dialogMsg .diaolgBtn").hide();
        if(showBtn)
            $("#dialogMsg "+showBtn).show();
        $("#dialogMsg .weui-dialog__bd").html(text);
        $("#dialogMsg").show();
    }
    function closeMsg(){
        $("#dialogMsg").hide();
    }

    function showConfim(text,fn){
        $("#dialogConfim .weui-dialog__bd").html(text);
        $("#dialogConfim .btn_ok").unbind().bind('click',fn);
        $("#dialogConfim").show()
    }
    function changeConfimText(text){
        $("#dialogConfim .weui-dialog__bd").html(text);
    }
    function closeConfim(){
        if(canCloseConfim)
            $("#dialogConfim").hide();
    }

    function openUsers(){
        $("#dialogUsers").show();
        //$("body").css('overflow','hidden');

    }
    function closeUsers(){
        if(!isSubmit){
            $("#dialogUsers").hide();
            //$("body").css('overflow','auto');
            $("#searchInput").val('');
            $(".hid_setTopic").hide();
            $(".hid_selUsers").show();
            $("#div_isHasComp").hide();
            $("#selMeetingUserNum").text(0);
            $('#dialogUsers i.weui-icon-success').removeClass('weui-icon-success').addClass('weui-icon-circle');
            $("#showMeetingUsers").html('');
            $("#btn_confimSelUser").text('确认');
            $("#val_topic").val('');
            $("#btn_cancelSelUser").unbind().bind('click',closeUsers);
            closeAllUser();
        }
    }

    //处理会议室预定数据
    function loadReserve(){
        reserveMap={};
        $.each(JSON.parse(reserve),function(k,v){
            pushReserve(v)
        });
    }

    function pushReserve(reserveData){
        var day = parseInt(reserveData.meetingDate.substr(8,2));
        if(!reserveMap[day])
            reserveMap[day]={};
        var rooms = reserveMap[day];
        if(!rooms[reserveData.roomId])
            rooms[reserveData.roomId]=[];
        var room = rooms[reserveData.roomId];
        room.push(reserveData);
    }
    function removeReserve(reserveData){
        var day = parseInt(reserveData.meetingDate.substr(8,2));
        var rooms = reserveMap[day];
        var room = rooms[reserveData.roomId];
        for(var i=0; i<room.length; i++){
            if(room[i].id==reserveData.id){
                room.splice(i,1);
                break;
            }
        }
        if(room.length==0){
            rooms[reserveData.roomId]=undefined;
            if(reserveMap[day].length==0)
                reserveMap[day]=undefined;
        }
    }


    //加载会议室列表
    function loadRooms(){
        var html = $("#room_model").html();
        $.each(JSON.parse(rooms),function(k,v){
            var div = $(html);
            div.attr('data-id',v.id);
            div.attr('id','room_'+v.id);
            div.find('.name').text(v.name);
            if(v.descriptionKey){
                $.each(v.descriptionKey.split(','),function(k,v){
                    div.find('.ordertime').before('<div class="boxsets">'+v+'</div>');
                });
            }

            $("#rooms").append(div);
        });
        initTimeClick();
    }

    //刷新改变时间是否可选
    function refReserveUI(){
        $(".meetbtn1,.meetbtn3").removeClass('meetbtn1 meetbtn3').addClass('meetbtn2').text('请选择');
        $(".box .ordertime li").removeClass('no xuank xuanz xuanj seledStart seledMiddle seledEnd tipsno selfStart selfMiddle selfEnd');
        $(".ordertime").removeAttr('isStartClicked');
        var day = parseInt($(".s_timelis.select").text());
        var rooms = reserveMap[day];
        if(rooms){
            $.each(rooms,function(roomId,roomReserve){
                var roomTimeDiv = $("#room_"+roomId+" .ordertime");
                if(roomTimeDiv.length==1){
                    $.each(roomReserve,function(k,v){
                        var startTime = v.startTime;
                        var endTime = v.endTime;
                        roomTimeDiv.find('li[data-val='+startTime+']').addClass('seledStart no '+addSelfClass(v.wxno,'selfStart')).attr('data-name',v.userName).attr('data-wxno',v.wxno).attr('data-id',v.id);
                        startTime = addTime(startTime);
                        for(;startTime<=endTime; startTime=addTime(startTime)){
                            var li = roomTimeDiv.find('li[data-val='+startTime+']');
                            if(startTime==endTime){
                                li.addClass('seledEnd '+addSelfClass(v.wxno,'selfEnd')+(li.hasClass('isEnd') || li.hasClass('seledStart')?' no':''));
                            }else{
                                li.addClass('seledMiddle no '+addSelfClass(v.wxno,'selfMiddle'));
                            }
                        }
                    });

                    refBtnState(roomTimeDiv.parent());
                }
            });

        }

        /* disExpTime(day);
        $.each($("div.box"),function(k,v){
            refBtnState($(v));
        }); */
    }

    //取消会议
    var cancelData;
    function clickCancelMeeting(){
        closeMsg();
        showConfim('确定要撤销该预定吗?<br/>'+cancelData.sTime+'~'+cancelData.eTime,function(){
            if(canCloseConfim){
                canCloseConfim=false;
                changeConfimText("撤销中··");
                $.ajax({
                    url:'meeting/cancelMeeting',
                    type:'post',
                    dataType:'json',
                    data:{id:cancelData.id},
                    success:function(data){
                        canCloseConfim=true;
                        if(data.result=='true'){
                            removeReserve(cancelData);
                            setReserveCancel($("#room_"+cancelData.roomId+" .ordertime"),cancelData.startTime,cancelData.endTime)
                            closeConfim();
                            showMsg('撤销成功');
                        }else{
                            refReserveUI();
                            showMsg(data.result);
                        }
                    },complete:function(){
                        canCloseConfim=true;
                    },error:function(){
                        submBtn.text('预定');
                    }
                });
            }
        })
    }

    //显示已预订的消息，并有取消功能
    function showMeetinedMsg(text,data){
        if(GLOBAL_WXNO==data.wxno){
            cancelData=data;
            showMsg(text,".btn_cancelMeeting");
        }else{
            showMsg(text);
        }
    }

    function disExpTime(day){
        if(currTime.getDate()==day){
            var time = parseInt(currTime.getHours()+(currTime.getMinutes()<10?'0'+currTime.getMinutes():''+currTime.getMinutes()));
            $.each($(".ordertime li"),function(k,v){
                var li = $(v);
                if(li.attr('data-val')<time){
                    li.addClass('no')
                }
            });
        }
    }


    function addSelfClass(wxno,clz){
        return GLOBAL_WXNO==wxno?clz:'';
    }

    function addTime(time){
        time = parseInt(time);
        if(time==1200)
            return 1400;
        if((time+'').endsWith('00'))
            return time+=30;
        else
            return time-30+100;
    }

    function closeAllUser(){
        var list_dep = $("#dialogUsers .list-dep-div i.point-down").removeClass('point-down').addClass('point-right');
        $("#dialogUsers .list-dep-div").next().hide();
        $("#dialogUsers .list-dep-parent").show();
        $("#dialogUsers .list-user-div").show();
    }
    function openAllUser(isNotShowUser){
        var list_dep = $("#dialogUsers .list-dep-div i.point-right").removeClass('point-right').addClass('point-down');
        if(!isNotShowUser)
            $("#dialogUsers .list-dep-div").next().show();
    }

    function initDepartments(){
        var html='';
        $.each(JSON.parse(departments),function(k,v){
            html += '<div class="list-dep-parent">';
            html += 	'<div class="list-dep-div"><i class="point-right vem"></i> <span class="vem">'+v.name+'</span></div>';
            html += 	'<div class="list-user-parent" style="display:none">';
            $.each(v.users,function(k,user){
                var src = user.avatar==''?'/images/default_head.png':user.avatar;
                html += '<div class="list-user-div" data-name="'+user.name+'" data-namepy="'+user.namePy+'" data-namepyfirst="'+user.namePyFirst+'" data-wxno="'+user.wxno+'"><img width="36" height="36" src="'+src+'" class="vem"/> <span>'+user.name+'</span>'
                html += '	<i class="weui-icon-circle" style="float:right;margin-top:8px" data-name="'+user.name+'" data-wxno="'+user.wxno+'" data-avatar="'+src+'"></i>'
                html += '</div>';
            });
            html += 	'</div>';
            html += '</div>';
        });
        $("#departments-div").append(html);
    }

    function confimSelUser(dialogUsers,submBtn,roomDiv,roomId,roomName,roomTimeDiv,date,startText,endText,startTime,endTime){
        $("#btn_confimSelUser").unbind().bind('click',function(){
            var users = [];
            var subUsers=[];
            var exit={};
            $.each(dialogUsers.find(".weui-icon-success"),function(k,v){
                v = $(v);
                var wxno=v.attr('data-wxno');
                var name=v.attr('data-name');
                var avatar=v.attr('data-avatar');
                if(exit[wxno]==undefined){
                    exit[wxno]=true;
                    users.push({wxno:wxno,name:name,avatar:avatar});
                    subUsers.push([wxno,name]);
                }
            });

            $("#btn_cancelSelUser").unbind().bind('click',function(){
                dialogUsers.find(".hid_selUsers").show();
                dialogUsers.find(".hid_setTopic").hide();
                $("#btn_cancelSelUser").text('取消');
                $("#btn_cancelSelUser").unbind().bind('click',closeUsers);
                confimSelUser(dialogUsers,submBtn,roomDiv,roomId,roomName,roomTimeDiv,date,startText,endText,startTime,endTime);
            });
            $("#btn_cancelSelUser").text('返回');
            $("#meetingUserNum").text(users.length);
            dialogUsers.find(".hid_selUsers").hide();
            dialogUsers.find(".hid_setTopic").show();
            var html='';
            $.each(users,function(k,v){
                html += '<div class="list-user-div-show">';
                html += '<img width="28" src="'+v.avatar+'" class="vem"> <span>'+v.name+'</span>';
                html += '</div>';
            });
            $("#showMeetingUsers").html(html);

            $("#btn_confimSelUser").unbind().bind('click',function(){
                if(isSubmit) return;
                isSubmit=true;
                var topic=$.trim($("#val_topic").val());
                $("#btn_confimSelUser").text('提交中··');

                $.ajax({
                    url:'meeting/addMeeting',
                    type:'post',
                    dataType:'json',
                    data:{roomId:roomId,date:date,startTime:startTime,endTime:endTime,topic:topic,users:JSON.stringify(subUsers)},
                    success:function(data){
                        if(data.result=='true'){
                            pushReserve(data.reserve);
                            setReserveOK(roomTimeDiv,data.reserve.id,startTime,endTime,data.reserve.wxno,data.reserve.userName);
                            showMsg('预订成功<br/>'+roomName+'<br/>'+date+' '+startText+'~'+endText);
                        }else if(data.result=='haveConf'){
                            reserve = data.reserveList;
                            loadReserve();
                            refReserveUI();
                            showMsg('会议时间存在冲突,请重新预定');
                        }else{
                            refReserveUI();
                            showMsg(data.result);
                        }
                    },complete:function(){
                        isSubmit=false;
                        closeUsers();
                    },error:function(){
                        submBtn.text('预定');
                    }
                });
            });
        });
    }
</script>
</html>